﻿#region Using declarations
using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    partial class Strategy
    {
        ///Returns the numerical value of a text string, zero if the string not numeric.
        ///Syntax: StrToNum(String)
        ///String: a text string expression (a variable or text contained within quote marks).
        public double StrToNum(String str)
        {
            double result;
            NumberFormatInfo provider = new NumberFormatInfo();
            provider.NumberDecimalSeparator = ".";

            try
            {
                result = Convert.ToDouble(str, provider);
            }
            catch
            {
                result = 0;
            }
            return result;
        }

    }
}
